import requests,re
from Lib import _chrome

def scraw_proxies(page_num, scraw_url="http://www.xicidaili.com/nt/"):
    #使用国内高匿代理
    scraw_url = "http://www.xicidaili.com/nn/"
    ip = []
    print("抓取第%d页代理IP" % page_num)
    url = scraw_url + str(page_num)
    r = requests.get(url, headers=_chrome.get_random_header())
    r.encoding = 'utf-8'
    pattern = re.compile('<td class="country">.*?alt="Cn" />.*?</td>.*?<td>(.*?)</td>.*?<td>(.*?)</td>', re.S)
    scraw_ip = re.findall(pattern, r.text)
    print(scraw_ip)
    ip = scraw_ip
    print('抓取结束')
    return ip